Page({
  data: {
    list:{
      id:'0',
      name:'谢文婷',
      sex:'1',
      cardnum:'420117201202568525',
      telephone:'18569458623',
      ma: '/static/二维码.png',
  },
    sex:['男','女'],
    animationMain:null,//正面
    animationBack:null,//背面
},
//卡片翻转
rotateFn(e) {
  var id = e.currentTarget.dataset.id
  this.animation_main = wx.createAnimation({
      duration:400,
      timingFunction:'linear'
    })
    this.animation_back = wx.createAnimation({
      duration:400,
      timingFunction:'linear'
    })
  // 点击正面

  if (id==1) {
    this.animation_main.rotateY(180).step()
    this.animation_back.rotateY(0).step()
    this.setData({
      animationMain: this.animation_main.export(),
      animationBack: this.animation_back.export(),
    })
  }
  // 点击背面
  else{
    this.animation_main.rotateY(0).step()
    this.animation_back.rotateY(-180).step()
    this.setData({
      animationMain: this.animation_main.export(),
      animationBack: this.animation_back.export(),
    })
  }
},

// 图片点击放大
previewImage:function(event){
  var current = event.currentTarget.dataset.src;
  console.log(current)
  wx.previewImage({
    current: current, // 当前显示图片的http链接
  })
  
},
//页面加载设置初始值 可以不要
  onReady(res){
    
  },
//点击事件-调取照相机
  submitImage:function(e){
    var that = this;
    var roomID = that.data.roomID;
    wx.chooseImage({
      count: 1,
      sizeType: ['original'],
      sourceType: ['album', 'camera'],
      success: (res) => {
              const tempFilePaths = res.tempFilePaths[0]
              that.setData({
                  imgSrc: tempFilePaths
              });
              wx.uploadFile({
                  url: 'https://www.xxxxxx.com/img', //服务器接口地址
                  filePath: tempFilePaths,
                  name: 'file',
                  formData:{
                    'roomID': roomID
                  },
                  header: {

                  'content-type': 'multipart/form-data'

                  },
                  success: function (res) {
                    var data = res.data;
                    console.log(data);
                  },
                  fail: function (e) {
                    console.log(e.stack);
                  }
              })
          }
      })
  },
  toAddperson:function(){
    wx.navigateTo({
      url: '../ckjzr/ckjzr'
    })
  },
  toSuggest:function(){
    wx.navigateTo({
      url: '../yjfk/yjfk'
    })
  },
  toRegistration:function(){
    wx.navigateTo({
      url: '../ghjl/ghjl'
    })
  },
  tozdjl:function(){
    wx.navigateTo({
      url: '../dzbl/dzbl'
    }) 
  },
history:function(){
  wx.navigateTo({
    url: '../jfjl/jfjl'
  }) 
}

})